#pragma once

class DeleteEmailHandler : public JsonRequest<Test> 
{
public:
	bool response()
	{
		std::string		email;
		sql_string<>	sql;

		if(false == request::get("email", email))
		{
			err << "invalid paramter";
			return false;
		}
		
		sql.format("delete from t_emails where addr='%q'",
				email.c_str());
		if(1 != sql::execute(sql.c_str()))
		{
			err << "delete email failed:"
				<< sql.c_str();
			return false;
		}
		
		json.push_back(JSONNode("errno", 0));
		return true;
	}
};
